#pragma once

#include "Defines.h"
#include "Vector3.h"
#include "ColorValue.h"
#include "Effect.h"
#include "MemoryAlloc.h"

VAMPIRE_NAMESPACE_BEGIN

class _VampireExport PhoneLight : public Effect
{
public:

	struct Handles
	{
		D3DXHANDLE  modelViewProj;
		D3DXHANDLE  globalAmbient;
		D3DXHANDLE  diffuseColor;
		D3DXHANDLE  specularColor;
		D3DXHANDLE  lightPos;
		D3DXHANDLE  eyePos;
		D3DXHANDLE  kEmissive;
		D3DXHANDLE  kAmbient;
		D3DXHANDLE  kDiffuse;
		D3DXHANDLE  kSpecular;
		D3DXHANDLE  shininess;
	};

	struct GlobalFactors
	{
		ColorValue  globalAmbient;
		ColorValue  diffuseColor;
		ColorValue  specularColor;
		Vector3     lightPos; 
	};

	struct VariableFactors
	{
		Matrix44    modelViewProj;  
		Vector3     eyePos;       
		ColorValue  kEmissive;    
		ColorValue  kAmbient;    
		ColorValue  kDiffuse;     
		ColorValue  kSpecular;    
		Real        shininess;    
	};

	PhoneLight(void);

	void             bindHandles();

	void             setToDefault();

	void             setDiffuseColor(const ColorValue& color);

	void             setSpecularColor(const ColorValue& color);

	void             setPosition(const Vector3& pos);

	void             setTransformMatrix(const Matrix44& mat);

	void             setEyePosition(const Vector3& pos);

	void             setEmissive(const ColorValue& k);

	void             setAmbient(const ColorValue& k);

	void             setDiffuse(const ColorValue& k);

	void             setSpecular(const ColorValue& k);

	void             setShininess(Real s);

private:
	Handles          mHandles;
	GlobalFactors    mGlobals;
	VariableFactors  mVariables;

	REGISTER_HELPER(PhoneLight);
};

VAMPIRE_NAMESPACE_END